pub fn add(left: u64, right: u64) -> u64 {
    left + right
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }
}

mod front_of_house;

pub use crate::front_of_house::hosting;

pub fn eat_at_restaurant(){
    //相对路径
    // front_of_house::hosting::add_to_waitlist();
    //绝对路径
    // crate::front_of_house::hosting::add_to_waitlist();
    // 使用use 之后的路径

    hosting::add_to_waitlist();
}

mod back_of_house{
    pub struct Breakfast{
        pub toast: String,
        seasonal_fruit: String,
    }

    impl Breakfast{
        //这个地方是 函数的返回值
        pub fn summer(toast: &str) -> Breakfast{
            //这个具体返回的实例
            Breakfast{
                toast: String::from(toast),
                seasonal_fruit: String::from("peaches"),
            }
        }
    }

    pub enum Appetizer{
        Soup,
        Salad,
    }
}

pub fn eat_at_restaurant_back(){
    // 选择 黑面包作为早餐
    let mut meal = back_of_house::Breakfast::summer("Rye");
    // 修改早餐中的吐司
    meal.toast = String::from("Wheat");
    println!("I'd like {} toast please", meal.toast);

    // 不能访问 seasonal_fruit 因为它没有标记为 pub
    // meal.seasonal_fruit = String::from("blueberries");

    let order1 = back_of_house::Appetizer::Soup;
    let order2 = back_of_house::Appetizer::Salad;
}
